﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Model.Entities;
using Bussiness;
using Totoro.Passport; 

namespace PerssionCenterServices.Account
{
    public partial class SignInPage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
           


        }
        protected void LogonClick(object sender, EventArgs e)
        {
            CheckPermission();
        }
        private void CheckPermission()
        { 
            string strName = this.txtName.Value;
            string strPassword = this.txtPassword.Value;
            Ticket t = Permission.CheckPermission(strName, strPassword);
            if (t != null)//密码验证通过
            {
                string url = HttpContext.Current.Request.QueryString["ru"];
                HttpContext.Current.Response.SetCookie(new HttpCookie("tt_ticket", t.SerializeTicketToStr()));
                HttpContext.Current.Response.Redirect(url);
                HttpContext.Current.Response.End();

            }
            else {
                HttpContext.Current.Response.Write("用户名或密码错误!");
            }
        }
    }
}